const express = require('express')
const cookieParser = require('cookie-parser');
// const expressSession = require("express-session");
const app = express();
app.use(cookieParser())
app.get('/shezhi',(req,res)=>{
    res.cookie('name','张辉',{
        maxAge:1000*60*60
    });
    res.send('设置cookie')
})
app.get('/chakan',(req,res)=>{
    console.log(req.cookies);
    res.send('获取到cookie值')
})
app.get('/shanchu',(req,res)=>{
    res.clearCookie('name')
    res.send('删除了cookie的值')
})
app.listen(5000,err=>{
    if(!err)console.log('启动成功');
    else console.log(err);
})
//npm run dev